#	krawsk : kernel raw socket example Module Make File	
#
#	Author: SaeedM <saeed.tx@gmail.com> , Aug-2011
#
# 
# 	This program is free software; you can redistribute it and/or
#       modify it under the terms of the GNU General Public License
#       as published by the Free Software Foundation; either version
#       2 of the License, or (at your option) any later version
#
# obj-m is a list of what kernel modules to build.  The .o and other
# objects will be automatically built from the corresponding .c file -
# no need to list the source files explicitly.

# Add your debugging flag (or not) to CFLAGS
ifeq ($(DEBUG),y)
  DEBFLAGS = -O -g -DDEBUG # "-O" is needed to expand inlines
else
  DEBFLAGS = -O2
endif

EXTRA_CFLAGS += $(DEBFLAGS)
RXTRA_CFLAGS += -I$(LDDINC)

krawsk-objs  := main.o krawsock.o 

obj-m := krawsk.o 



# KDIR is the location of the kernel source.  The current standard is
# to link to the associated source tree from the directory containing
# the compiled modules.
KDIR  := /lib/modules/$(shell uname -r)/build

#WARN    := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
#INCLUDE := -isystem ${KDIR} -I.

#${WARN} ${INCLUDE} 

# PWD is the current working directory and the location of our module
# source files.
PWD   := $(shell pwd)

#EXTRA_CFLAGS  +:= -DMODULE -D__KERNEL__ -I${PWD}

# default is the default make target.  The rule here says to run make
# with a working directory of the directory containing the kernel
# source and compile only the modules in the PWD (local) directory.
default:
	$(MAKE) -C $(KDIR) M=$(PWD) LDDINC=. modules

depend .depend dep:
	$(CC) $(EXTRA_CFLAGS) -M *.c > .depend


ifeq (.depend,$(wildcard .depend))
	include .depend
endif


clean:
	rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions

